package au.csiro.nt.psdp.manager.Impl;

import org.appfuse.model.LabelValue;
import org.appfuse.service.impl.UniversalManagerImpl;
import org.appfuse.service.LookupManager;

import java.util.ArrayList;
import java.util.List;

import au.csiro.nt.psdp.model.Role;
import au.csiro.nt.psdp.dao.LookupDao;


/**
 * Implementation of LookupManager interface to talk to the persistence layer.
 *
 */
public class LookupManagerImpl extends UniversalManagerImpl implements LookupManager
{
    private LookupDao dao;

    public void setLookupDao(LookupDao dao)
    {
        super.dao = dao;
        this.dao = dao;
    }

    /**
     * @see org.appfuse.service.LookupManager#getAllRoles()
     */
    public List<LabelValue> getAllRoles()
    {
        List<Role> roles = dao.getRoles();
        List<LabelValue> list = new ArrayList<LabelValue>();

        for (Role role1 : roles)
        {
            list.add(new LabelValue(role1.getName(), role1.getName()));
        }

        return list;
    }
}
